/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package view;

import com.sun.lwuit.Display;
import com.sun.lwuit.Form;
import com.sun.lwuit.TextArea;
import com.sun.lwuit.layouts.BorderLayout;
import view.commands.BackCommand;
import view.commands.CenterCommand;

/**
 *
 * @author kvest
 */
public class TextForm extends Form
{ 
    private TextArea text;

    public TextForm()
    {
        super();

        init();
    }

    public TextForm(String title)
    {
        super(title);

        init();
    }

    public void setText(String value)
    {
        text.setText(value);
    }

    private void init()
    {
        setLayout(new BorderLayout());
        setScrollable(false);

        text = new TextArea("");
        text.setEditable(false);
        text.setGrowByContent(true);
        addComponent(BorderLayout.NORTH, text);

        //Команды
        BackCommand backCommand = new BackCommand();
        CenterCommand centerCommand = new CenterCommand(backCommand);
        if (!Display.getInstance().isTouchScreenDevice())
        {
            addCommand(centerCommand);
        }
        addCommand(backCommand);
    }
}
